<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>产品分销管理</title>
    <link type="text/css" href="/supplier/public/pc/css/v1/base.css" rel="stylesheet">
    <link type="text/css" href="/supplier/public/pc/css/v1/home.css" rel="stylesheet">
    <link type="text/css" href="/supplier/public/pc/css/supplier_pub.css" rel="stylesheet">
    <link type="text/css" href="/tools/js/msgbox/msgbox.css" rel="stylesheet">
    <link type="text/css" href="/supplier/public/pc/css/supplier_back.css" rel="stylesheet">
    {Common::js('jquery.min.js,common.js,product.js,choose.js')}
    <script src="/supplier/public/pc/js/laypage/laypage.js"></script>
    <script src="/tools/js/msgbox/msgbox.js"></script>
</head>
<body>
<div class="supplier-main-block">
    <div class="block-tab-container">
        <div class="block-tab-wrap-list">
            <div class="cl mt-5 mb-5">
                <a class="fr refresh-btn" onclick="window.location.reload()" href="javascript:;">刷新</a>
            </div>
            <!-- 搜索栏 -->
            <div class="table-view-box">
                <table class="table-view-group">
                    <thead>
                    <tr>
                        <th width="10%">渠道</th>
                        <th width="10%">分销状态</th>
                        <th width="40%" class="name">介绍</th>
<!--                        <th width="20%">设置</th>-->
                        <th width="10%">预览</th>
                    </tr>
                    </thead>
                    <tbody class="product-list-container">
                    {loop $channel $c}
                        <tr height="60px">
                            <td>{$c['title']}</td>
                            <td>
                                <a href="javascript:;" data-status="{$c['status']}" onclick="update_status({$c['id']},$(this))">
                                    {if $c['status']==1}<span class="col-red">批量下架</span>{else}<span class="color-green">批量上架</span>{/if}
                                </a>
                            </td>
                            <td style="text-align: left">{$c['introduce']}</td>
<!--                            <td>{if $c['id']==1}<a class="color-green" href="/supplier_shop/shop/config">设置</a>{/if}</td>-->
                            {if $c['id']==1}
                            <td>
                                <a class="color-green" target="_blank" href="{$c['pc_shop']}">电脑端店铺预览</a>
                                </br>
                                <a class="color-green" target="_blank" href="{$c['wap_shop']}">移动端店铺预览</a>
                            </td>
                            {elseif $c['id']==2}
                            <td></td>
                            {else}
                            <td>
                                <a class="color-green" target="_blank" href="{$b2b_url}">同业采销预览</a>
                            </td>
                            {/if}
                        </tr>
                    {/loop}
                    </tbody>
                </table>
            </div>
            <!-- 列表视图 -->
        </div>
    </div>
</div>
<script>
    function update_status(channel_id,obj)
    {
        var status = obj.attr('data-status');
        $.ajax({
            type: 'post',
            url: '/supplier/pc/channel/ajax_channel_status/',
            data: {status:status,channel_id:channel_id},
            dataType: 'json',
            success: function (data) {
                obj.html(status==1?'<span class="col-green">批量上架</span>':'<span class="col-red">批量下架</span>');
                obj.attr('data-status',status==1?2:1);
                ST.Util.showMsg(data==1?'操作成功':'操作失败', data==1?4:5, 1000);
            }
        })
    }
</script>
</body>
</html>